﻿<phone:PhoneApplicationPage
    x:Class="Fabrikam.Phone.DetailsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:maps="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
    xmlns:maptk="clr-namespace:Microsoft.Phone.Maps.Toolkit;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:converters="clr-namespace:Fabrikam.Phone.Converters"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">


    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>


    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar  >
            <shell:ApplicationBarIconButton IconUri="/Icons/edit.png" IsEnabled="True" Text="Edit" Click="ApplicationBarEditClicked"  />
            <shell:ApplicationBarIconButton IconUri="/Icons/delete.png" IsEnabled="True" Text="Delete" Click="ApplicationBarDeleteClicked" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

    <phone:PhoneApplicationPage.Resources>
        <converters:StatusToBrushConverter x:Key="StatusToBrushConverter" />
        <converters:StatusToNameConverter x:Key="StatusToNameConverter" />

    </phone:PhoneApplicationPage.Resources>
    
    <!--Data context is set to sample data above and first item in sample data collection below and LayoutRoot contains the root grid where all other page content is placed-->
    <Grid x:Name="LayoutRoot" >
        <Grid.Background>
            <ImageBrush ImageSource="Assets/Background.png"></ImageBrush>
        </Grid.Background>

        <phone:Panorama Name="PanoramaList" Title="Détails">
            <phone:PanoramaItem Header="{Binding CustomerFullName}">
                <ScrollViewer Grid.Row="1" Margin="12,0,12,0">
                    <StackPanel x:Name="ContentPanel" >

                        <TextBlock Text="Address" Margin="12,0,0,0" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                        <TextBlock Text="{Binding CustomerFullAddress}" Margin="12,0,0,0" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextSubtleStyle}"/>

                        <TextBlock Text="Opened" Margin="12,12,0,0" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                        <TextBlock Text="{Binding OpenedString}" Margin="12,0,0,0" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextSubtleStyle}"/>

                        <TextBlock Text="Closed" Margin="12,12,0,0" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                        <TextBlock Text="{Binding ClosedString}" Margin="12,0,0,0" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextSubtleStyle}"/>
                      
                    </StackPanel>
                </ScrollViewer>

            </phone:PanoramaItem>

            <phone:PanoramaItem Header="Ticket">
                <ScrollViewer Grid.Row="1" Margin="12,0,12,0">
                    <StackPanel>

                        <TextBlock Text="{Binding ServiceTicket.Title}" Margin="12,0,0,0" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>

                        <StackPanel Orientation="Horizontal" Margin="12,12,0,0">
                            <Rectangle Fill="{Binding StatusValue, Converter={StaticResource StatusToBrushConverter}}" Width="43" Height="43"/>
                            <TextBlock Text="{Binding StatusValue, Converter={StaticResource StatusToNameConverter}}" Margin="16 0 0 0"
                                                   FontSize="43" FontFamily="{StaticResource PhoneFontFamilyLight}" />
                        </StackPanel>
                        <TextBlock Text="{Binding ServiceTicket.Description}" Margin="12,12,0,0" 
                       TextWrapping="Wrap" 
                       Style="{StaticResource PhoneTextSubtleStyle}"/>
                    </StackPanel>
                </ScrollViewer>

            </phone:PanoramaItem>

            <phone:PanoramaItem Header="Map">
                <maps:Map x:Name="Map" Grid.Row="1" Hold="OnMapHold" Margin="0,0,0,12">
                    <maptk:MapExtensions.Children>
                        <maptk:Pushpin x:Name="RouteDirectionsPushPin" Visibility="Collapsed"/>
                        <maptk:MapItemsControl Name="StoresMapItemsControl">
                            <maptk:MapItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <maptk:Pushpin 
                                        GeoCoordinate="{Binding GeoCoordinate}" 
                                        Visibility="{Binding Visibility}" 
                                        Content="{Binding Address}"/>
                                </DataTemplate>
                            </maptk:MapItemsControl.ItemTemplate>
                        </maptk:MapItemsControl>
                        <maptk:UserLocationMarker x:Name="UserLocationMarker" Visibility="Collapsed"/>
                    </maptk:MapExtensions.Children>
                </maps:Map>
            </phone:PanoramaItem>
        </phone:Panorama>


        <!--TitlePanel contains the name of the application and page title-->

        <!--ContentPanel contains details text. Place additional content here-->

        <!--Uncomment to see an alignment grid to help ensure your controls are
            aligned on common boundaries.  The image has a top margin of -32px to
            account for the System Tray. Set this to 0 (or remove the margin altogether)
            if the System Tray is hidden.

            Before shipping remove this XAML and the image itself.-->
        <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->
    </Grid>

</phone:PhoneApplicationPage>